﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;
/// <summary>
/// Summary description for Utility
/// </summary>
public class Utility
{
	public Utility()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public static string EncodePass(string str)
    {
        System.Security.Cryptography.MD5CryptoServiceProvider encode = new System.Security.Cryptography.MD5CryptoServiceProvider();
        byte[] pass = System.Text.Encoding.UTF8.GetBytes(str);
        pass = encode.ComputeHash(pass);
        System.Text.StringBuilder build = new System.Text.StringBuilder();
        foreach (byte p in pass)
        {
            build.Append(p.ToString());
        }
        return build.ToString();
    }

    public static string Encode(string str)
    {
        
        return HttpContext.Current.Server.HtmlEncode(str);
        
    }

    public static string Decode(string str)
    {
        return HttpContext.Current.Server.HtmlDecode(str);
    }
}
